<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let data = {
      id: 1,
      uname: 'zs',
      age: 18
    }

    // id=1&uname=zs&age=18
    // function handleData(data) {
    //   let arr = []
    //   for(let key in data) {
    //     arr.push(`${key}=${data[key]}`)
    //   }
    //   return arr.join('&')
    // }

    function handleData(data) {
      let str = ''
      for(let key in data) {
        str += `${key}=${data[key]}&`
      }
      return str.slice(0, str.length - 1)
    }

    let str = handleData(data)
  </script>
</body>
</html>